package easy;

public class a495_提莫攻击 {
    public int findPoisonedDuration(int[] timeSeries, int duration) {
        int ans = duration;
        for (int i = 1; i < timeSeries.length; i++) {
            int temp = timeSeries[i] - timeSeries[i - 1];
            if (temp < duration) ans += temp;
            else {
                ans += duration;
            }
        }

        return ans;
    }
}
